﻿<script type="application/javascript">
	function changeCurr(id,price)
	{
		usd = document.getElementById(id+"usd");
		sjc = document.getElementById(id+"sjc");
		vnd = document.getElementById(id+"vnd");
		usdid = document.getElementById("usd"+id);
		sjcid = document.getElementById("sjc"+id);
		vndid = document.getElementById("vnd"+id);
		if(price == "usd")
		{
			usd.style.display = "block";
			sjc.style.display = "none";
			vnd.style.display = "none";

			usdid.className = "USD active_rate";
			sjcid.className = "USD";
			vndid.className = "USD";
		}
		else if(price == "sjc")
		{
			usd.style.display = "none";
			sjc.style.display = "block";
			vnd.style.display = "none";
			usdid.className = "USD";
			sjcid.className = "USD active_rate";
			vndid.className = "USD";
		}
		else if (price == "vnd")
		{
			usd.style.display = "none";
			sjc.style.display = "none";
			vnd.style.display = "block";
			usdid.className = "USD";
			sjcid.className = "USD";
			vndid.className = "USD active_rate";
		}
	}
</script>
<?php
	$a =&get_instance();
	$a->load->model('Mnews_cat');
	$data =	$a->Mnews_cat->get_catdata() ;
	$ku=0;
	foreach($data as $item)
	{
		$ku++;
?>

		<div class="left_title_cuv"></div>
        <div class="mid_title_cuv"><?php echo $item["cat_name"]?></div>
        <div class="right_title_cuv"></div>
         <div class="content">
        <?php if(!empty($item["proname"])) foreach($item["proname"] as $subitem){?>
        <div class="outer_pro" style="margin-left:0px;">
            		<a href="<?php echo base_url()?>news/detail/<?php echo $subitem['news_id']?>/<?php echo $subitem['cat_id']?>">
                   	 <img src="<?php echo base_url()?>upload/news/<?php echo $subitem['news_image']?>" class="img_pro"/>
                    </a>
            		<a href="javascript:changeCurr(<?php echo $subitem['news_id']?> ,'usd');" id="usd<?php echo $subitem['news_id']?>" class="USD active_rate" style="margin-left:30px;">USD</a>
                	<a href="javascript:changeCurr(<?php echo $subitem['news_id']?>,'sjc');" id="sjc<?php echo $subitem['news_id']?>" class="USD">SJC</a>
                    <a href="javascript:changeCurr(<?php echo $subitem['news_id']?>,'vnd');" id="vnd<?php echo $subitem['news_id']?>" class="USD">VND</a>

                    <span id="<?php echo $subitem['news_id']?>usd"><?php echo $subitem['news_price_usd'] ?> usd</span>
                    <span id="<?php echo $subitem['news_id']?>sjc"style="display:none" ><?php echo $subitem['news_price_sjc'] ?> sjc</span>
                    <span id="<?php echo $subitem['news_id']?>vnd"style="display:none" ><?php echo number_format($subitem['news_price_vnd'])?>vnd</span>
                    <a href="<?php echo base_url()?>news/detail/<?php echo $subitem['news_id']?> /<?php echo $subitem['cat_id']?> " class="pro_info"><?php if(empty($_SESSION['lang'])) echo $subitem['news_short_en'];else echo $subitem['news_short']?></a>

            </div><!--end outer_pro-->
            <?php } ?>
        </div><!--end content-->
<?php
	}
?>